package br.com.webhomesites.locacao.presenter;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class EmitirContratoPresenterActionListener {

    static class Modelo1ActionListener implements ActionListener {

        private EmitirContratoPresenter presenter;

        public Modelo1ActionListener(EmitirContratoPresenter presenter) {
            this.presenter = presenter;
        }

        @Override
        public void actionPerformed(ActionEvent evt) {
            presenter.getOperacao().execute();
            presenter.setModelo(presenter.MODELO1_STRATEGY);
            presenter.novoEmiritContrato();
            presenter.getModelo().execute();
            presenter.setOperacao(presenter.INSERIR_CONTRATO);
            presenter.habilitarEdicao(true);
            presenter.getView().dispose();
        }
    }
    
     static class Modelo2ActionListener implements ActionListener {

        private EmitirContratoPresenter presenter;

        public Modelo2ActionListener(EmitirContratoPresenter presenter) {
            this.presenter = presenter;
        }

        @Override
        public void actionPerformed(ActionEvent evt) {
            presenter.getOperacao().execute();
            presenter.setModelo(presenter.MODELO2_STRATEGY);
            presenter.novoEmiritContrato();
            presenter.getModelo().execute();
            presenter.setOperacao(presenter.INSERIR_CONTRATO);
            presenter.habilitarEdicao(true);
            presenter.getView().dispose();
        }
    }
     
      static class Modelo3ActionListener implements ActionListener {

        private EmitirContratoPresenter presenter;

        public Modelo3ActionListener(EmitirContratoPresenter presenter) {
            this.presenter = presenter;
        }

        @Override
        public void actionPerformed(ActionEvent evt) {
            presenter.getOperacao().execute();
            presenter.setModelo(presenter.MODELO3_STRATEGY);
            presenter.novoEmiritContrato();
            presenter.getModelo().execute();
            presenter.setOperacao(presenter.INSERIR_CONTRATO);
            presenter.habilitarEdicao(true);
            presenter.getView().dispose();       
        }
    }
      
       static class Modelo4ActionListener implements ActionListener {

        private EmitirContratoPresenter presenter;

        public Modelo4ActionListener(EmitirContratoPresenter presenter) {
            this.presenter = presenter;
        }

        @Override
        public void actionPerformed(ActionEvent evt) {
            presenter.getOperacao().execute();
            presenter.setModelo(presenter.MODELO4_STRATEGY);
            presenter.novoEmiritContrato();
            presenter.getModelo().execute();
            presenter.setOperacao(presenter.INSERIR_CONTRATO);
            presenter.habilitarEdicao(true);
            presenter.getView().dispose();
         }
    }

    static class CancelarActionListener implements ActionListener {

        private EmitirContratoPresenter presenter;

        public CancelarActionListener(EmitirContratoPresenter presenter) {
            this.presenter = presenter;
        }

        @Override
        public void actionPerformed(ActionEvent evt) {

            presenter.getView().dispose();
        }
    }  
}
